package Demo1;

import java.util.Scanner;

class Book{
    String name;
    int borroDays;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getBorroDays() {
        return borroDays;
    }
    public void setBorroDays(int borroDays) {
        this.borroDays = borroDays;
    }
    public Book(String name) {
        super();
        this.name = name;
    }
    public int calFines(int borroDays){
        return 0;
    }
}

class AdultBook extends Book{
    public AdultBook(String name) {
        super(name);
    }
    public int calFines(int borrowDays) {
        int num=borrowDays-21;
        if(num<=0) {
            return 0;
        }else if(num<=3){
            return num*2;
        }else {
            return (num-3)*5+3*2;
        }
    }

}

class KidBook extends Book{
    public KidBook(String name) {
        super(name);
    }
    public int calFines(int borrowDays) {
        int num=borrowDays-21;
        if(num<0) {
            return 0;
        }else
            return num;
    }
}

class Disc extends Book{
    public Disc(String name){
        super (name);
    }
    public int calFines(int borrowDays){
        int num=borrowDays-14;
        if(num<=0){
            return 0;
        }
        if(num<=3){
            return num*5;
        }
        else
            return (num-3)*10+3*5;
    }
}

class Customer{
    public double calTotalFines(Book books[],int borrowDays) {
        int sum=0;
        for(int i=0;i<books.length;i++) {
            sum=sum+books[i].calFines(borrowDays);
        }
        return sum;
    }

}

public class t1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan=new Scanner(System.in);
        Book[] books=new Book[5];
        books[0]=new AdultBook("半小时漫画中国史");
        books[1]=new AdultBook("博弈论");
        books[2]=new KidBook("法布尔昆虫记");
        books[3]=new KidBook("最好的朋友");
        books[4]=new Disc("白雪公主");
        Customer customer=new Customer();
        int borrowDays=scan.nextInt();
        double fines=customer.calTotalFines(books, borrowDays);
        System.out.println("您共归还书籍"+books.length+"本");
        for(int i=0;i<books.length;i++)
            System.out.println((i+1)+" "+books[i].getName());
        System.out.println("借阅时间："+borrowDays+"天");
        if(fines>0)
            System.out.println("共需缴纳罚金："+fines+"元");
        else
            System.out.println("借阅书籍未超期");
        scan.close();
    }

}

/* 请在这里填写答案 */

